{{define "Title"}}Set Routing{{end}}
{{define "Content"}}

<script type=text/javascript src="/js/tablestyle.js"></script>

<div class="container-fluid">
<form class="form-horizontal" action="/setrouting" method="POST">
  <fieldset>
    <legend><b>Set Routing</b></legend>
    {{if .error}}<div class="alert alert-error"><b>Error: </b>{{.error | html}}</div>
    {{else }}
      {{if .flash}}<div class="alert alert-success"><b>Infomation: </b>{{.flash | html}}</div>{{end}}
    {{end}}
    <div class="control-group">
      <label class="control-label">Routing Name&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="routname" name="routname" style="background-color: #FFFFD0;" maxlength="30"> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">Current Station&nbsp;</label>
      <div class="control">
        <select id="currstation" name="currstation" style="background-color: #FFFFD0" onmousewheel="return false">
          {{range .stations}}
            <option value="{{.Name | html}}">{{.Name | html}}
          {{end}}
        </select> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">Next Station&nbsp;</label>
      <div class="control">
        <select id="nextstation" name="nextstation" style="background-color: #FFFFD0" onmousewheel="return false">
          {{range .stations}}
            <option value="{{.Name | html}}">{{.Name | html}}
          {{end}}
          <option> [END] </option>
        </select> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">Repair Station&nbsp;</label>
      <div class="control">
        <select id="repairstation" name="repairstation" onmousewheel="return false">
          <option value="">
          {{range .rprpro}}
            <option value="{{.Data | html}}">{{.Data | html}}
          {{end}}
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">Recycle Station&nbsp;</label>
      <div class="control">
        <select id="cyclestation" name="cyclestation" onmousewheel="return false">
          <option value="">
          {{range .stations}}
            <option value="{{.Name | html}}">{{.Name | html}}
          {{end}}
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label"></label>
      <div class="control">
        <input type="checkbox" class="checkbox" id="bypass" name="bypass" value="1">ByPASS
      </div>
    </div>
    <div class="control-group">
      <label class="control-label"></label>
      <div class="control">
        <input type="checkbox" class="checkbox" id="musttest" name="musttest" value="1">Must be test at the station
      </div>
    </div>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary">Set Routing</button>
    </div>
  </fieldset>
</form>
</div>

{{if .routs}}
<div class="content-box">
  <div class="content-box-header">
    <p style="font-size: 16px;">&nbsp;&nbsp;<b>Routing</b></p>
  </div>
  <div class="content-box-content">
    <table id="tbl_ls" border="1" cellspacing="0" cellpadding="0">
      <thead>
        <tr>
          <th>Index</th>
          <th>Routing</th>
        </tr>  
      </thead>
      
      <tbody>
        {{range .routs}}
        <tr>
          <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center" width="40">{{.Index | html}}</td>
          <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center" width="120"><a href="/routing?q={{.Name | html}}" target="_blank">{{.Name | html}}</a></td>
        </tr>
        {{end}}
      </tbody>
      
    </table>
  </div>
</div>
{{end}}
  
{{end}}